
import java.io.File;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.JTextArea;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * GUIGPI.java
 *
 * Created on 28/09/2011, 07:51:03 PM
 */

/**
 *
 * @author macripco
 */
public class GUIPrincipal extends javax.swing.JFrame {

    private File ambiente;
    /** Creates new form GUIGPI */
    public GUIPrincipal() {
        initComponents();
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        buttonGroup1 = new javax.swing.ButtonGroup();
        buttonGroup2 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        Checkbox1 = new javax.swing.JCheckBox();
        boton2 = new javax.swing.JRadioButton();
        boton1 = new javax.swing.JRadioButton();
        boton3 = new javax.swing.JRadioButton();
        Checkbox2 = new javax.swing.JCheckBox();
        boton4 = new javax.swing.JRadioButton();
        boton5 = new javax.swing.JRadioButton();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();

        buttonGroup1.add(boton1);
        buttonGroup1.add(boton2);
        buttonGroup1.add(boton3);

        buttonGroup2.add(boton4);
        buttonGroup2.add(boton5);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Gestion De Parqueaderos Inteligente");

        jPanel1.setBackground(new java.awt.Color(46, 43, 85));
        jPanel1.setForeground(new java.awt.Color(46, 43, 85));

        jLabel1.setFont(new java.awt.Font("DejaVu Sans", 1, 18)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(244, 243, 238));
        jLabel1.setText("Gestor de Parqueadero Inteligente");

        jLabel3.setBackground(new java.awt.Color(46, 43, 85));
        jLabel3.setForeground(new java.awt.Color(254, 254, 254));
        jLabel3.setText("Elija el tipo de Algoritmo:");

        Checkbox1.setBackground(new java.awt.Color(46, 43, 85));
        Checkbox1.setFont(new java.awt.Font("DejaVu Sans", 1, 13)); // NOI18N
        Checkbox1.setForeground(new java.awt.Color(245, 243, 232));
        Checkbox1.setText("Busqueda No Informada");
        Checkbox1.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                Checkbox1ItemStateChanged(evt);
            }
        });
        Checkbox1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Checkbox1ActionPerformed(evt);
            }
        });

        boton2.setBackground(new java.awt.Color(46, 43, 85));
        boton2.setForeground(new java.awt.Color(254, 253, 250));
        boton2.setText("Costo Uniforme");
        boton2.setEnabled(false);
        boton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boton2ActionPerformed(evt);
            }
        });

        boton1.setBackground(new java.awt.Color(46, 43, 85));
        boton1.setForeground(new java.awt.Color(254, 254, 254));
        boton1.setText("Preferente por Amplitud");
        boton1.setEnabled(false);
        boton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boton1ActionPerformed(evt);
            }
        });

        boton3.setBackground(new java.awt.Color(46, 43, 85));
        boton3.setForeground(new java.awt.Color(254, 252, 246));
        boton3.setText("Preferente por prufundidad Evitando Ciclos");
        boton3.setEnabled(false);
        boton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boton3ActionPerformed(evt);
            }
        });

        Checkbox2.setBackground(new java.awt.Color(46, 43, 85));
        Checkbox2.setFont(new java.awt.Font("DejaVu Sans", 1, 13));
        Checkbox2.setForeground(new java.awt.Color(245, 243, 232));
        Checkbox2.setText("Busqueda Informada");
        Checkbox2.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                Checkbox2ItemStateChanged(evt);
            }
        });
        Checkbox2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Checkbox2ActionPerformed(evt);
            }
        });

        boton4.setBackground(new java.awt.Color(46, 43, 85));
        boton4.setForeground(new java.awt.Color(254, 254, 254));
        boton4.setText("Avara");
        boton4.setEnabled(false);
        boton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boton4ActionPerformed(evt);
            }
        });

        boton5.setBackground(new java.awt.Color(46, 43, 85));
        boton5.setForeground(new java.awt.Color(254, 254, 254));
        boton5.setText("A*");
        boton5.setEnabled(false);
        boton5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                boton5ActionPerformed(evt);
            }
        });

        jButton1.setText("Aceptar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jButton2.setBackground(new java.awt.Color(254, 254, 254));
        jButton2.setText("Seleccionar Ambiente");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jButton3.setText("Salir");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jLabel2.setIcon(new javax.swing.ImageIcon("/home/macripco/NetBeansProjects/GestionDeParqueaderoInteligente/carros.jpg")); // NOI18N

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(50, 50, 50)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(boton5)
                            .addComponent(boton4)))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(25, 25, 25)
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(Checkbox1)
                            .addComponent(Checkbox2)
                            .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGap(26, 26, 26)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(boton3)
                                    .addComponent(boton2)
                                    .addComponent(boton1)))))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel1)))
                .addGap(18, 18, 18)
                .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jButton2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(219, 219, 219))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(Checkbox1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(boton1)
                        .addGap(2, 2, 2)
                        .addComponent(boton2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(boton3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(Checkbox2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(boton4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(boton5))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(12, 12, 12)
                        .addComponent(jLabel2, 0, 0, Short.MAX_VALUE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton2)
                    .addComponent(jButton1)
                    .addComponent(jButton3))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 515, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void Checkbox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Checkbox1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Checkbox1ActionPerformed

    private void boton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boton2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_boton2ActionPerformed

    private void boton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boton1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_boton1ActionPerformed

    private void boton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boton3ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_boton3ActionPerformed

    private void Checkbox2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Checkbox2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_Checkbox2ActionPerformed

    private void boton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boton4ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_boton4ActionPerformed

    private void boton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_boton5ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_boton5ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
    JFileChooser selectorDeAmbiente=new JFileChooser();
    selectorDeAmbiente.setFileSelectionMode(JFileChooser.FILES_ONLY);
    JTextArea areaDeTexto=new JTextArea();
    int seleccion=selectorDeAmbiente.showOpenDialog(areaDeTexto);
    if (seleccion == JFileChooser.APPROVE_OPTION)
    {
         ambiente=selectorDeAmbiente.getSelectedFile();
    } 
       
    LectorDeArchivo archivo=new  LectorDeArchivo(ambiente);
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
       System.exit(0);
    }//GEN-LAST:event_jButton3ActionPerformed

    private void Checkbox1ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_Checkbox1ItemStateChanged
            
                boton1.setEnabled(true);
                boton2.setEnabled(true);
                boton3.setEnabled(true);
            
           
            if(Checkbox2.isSelected())
            {
                JOptionPane.showMessageDialog(null,"Seleccione una sola casilla");
                 boton1.setEnabled(false);
                 boton2.setEnabled(false);
                 boton3.setEnabled(false);
            }
            

    }//GEN-LAST:event_Checkbox1ItemStateChanged

    private void Checkbox2ItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_Checkbox2ItemStateChanged
                boton4.setEnabled(true);
                boton5.setEnabled(true);
                if(Checkbox1.isSelected())
                {
                    JOptionPane.showMessageDialog(null,"Seleccione una sola casilla");
                    boton4.setEnabled(false);
                    boton5.setEnabled(false);
                } 
    }//GEN-LAST:event_Checkbox2ItemStateChanged

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new GUIPrincipal().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox Checkbox1;
    private javax.swing.JCheckBox Checkbox2;
    private javax.swing.JRadioButton boton1;
    private javax.swing.JRadioButton boton2;
    private javax.swing.JRadioButton boton3;
    private javax.swing.JRadioButton boton4;
    private javax.swing.JRadioButton boton5;
    private javax.swing.ButtonGroup buttonGroup1;
    private javax.swing.ButtonGroup buttonGroup2;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    // End of variables declaration//GEN-END:variables

}
